// run: $exec < input
#include <iostream>
#include <algorithm>
#include <cmath>

struct data { int x, y; };

int const maxn = 200;
data da[maxn];
data p;
int n;
double r;

double dis(data const& a, data const& b)
{
	return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

int mul(data const& a, data const& b)
{
	return a.x * b.y - a.y * b.x;
}

bool judge(data const& a, data const& b, double r)
{
	if (dis(b, p) > r) return false;
	data ta = a, tb = b;
	ta.x -= p.x; ta.y -= p.y;
	tb.x -= p.x; tb.y -= p.y;
	return mul(ta, tb) >= 0;
}

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> p.x >> p.y >> r) {
		if (r <= 0) continue;
		std::cin >> n;
		for (int i = 0; i < n; i++) std::cin >> da[i].x >> da[i].y;
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int count = 0;
			for (int j = 0; j < n; j++)
				count += judge(da[i], da[j], r);
			ans = std::max(ans, count);
		}
		std::cout << ans << '\n';
	}
}

